﻿using Codeflows;
using Codeflows.Results;

namespace CodeflowsTests.Extensions.Codeflows
{
    public static class ResultExtensions
    {
        public static void RunAllPendingResults(this Result result)
        {
            while (result.IsPending)
            {
                var pendingResult = (PendingResult)result;
                pendingResult.PendingTask.Wait();
                result = pendingResult.PendingTask.Result;
            }
        } 
    }
}